package br.com.lucasddaniel.inbuzios.dao;

/**
 * Classe de cria�ao das tabelas.
 * 
 * @author ldsm
 * 
 */
public class TuristaEsquemaBanco {

	/** Define a vers�o do banco. */
	public static final int CURRENT_DATABASE_VERSION = 1;

	/** Nome da base da aplica��o. */
	public static final String DATA_BASE_NAME = "inbuzios_db";

	/** Tabela de Turista. */
	public static final String TABLE_NAME = "tb_turista";

	/** Chaves de tabelas como ex: chave estrangeira, etc... */
	public static final String TABLE_CONSTRAINTS = "";

	/** SQL de cria��o da tabela de responsavel */
	public static final String SQL_CREATE_TABLE;

	/**
	 * Cria��o da tabela de responsavel.
	 */
	public static final TableColumn TABLE_COLUMNS[] = {
			new TableColumn( "id", "INTEGER PRIMARY KEY AUTOINCREMENT," ),
			new TableColumn( "num_registro", "TEXT," ),
			new TableColumn( "vooIn", "TEXT," ),
			new TableColumn( "pousada", "TEXT," ),
			new TableColumn( "nome", "TEXT," ),
			new TableColumn( "quantidade", "INTEGER," ),
			new TableColumn( "vooOut", "TEXT," ),
			new TableColumn( "obs", "TEXT," ),
			new TableColumn( "motorista", "TEXT," ),
			new TableColumn( "operador", "TEXT," ),
			new TableColumn( "dataSaida", "TEXT," ),
			new TableColumn( "horaChegada", "NUMERIC" )
	};

	/* Bloco de inicializa��o */
	static {
		final String CREATE_TABLE = "CREATE TABLE ";

		StringBuilder builder = new StringBuilder();

		SQL_CREATE_TABLE = builder.append( CREATE_TABLE )
				.append( TABLE_NAME )
				.append( "(" )
				.append( TABLE_COLUMNS[0] )
				.append( TABLE_COLUMNS[1] )
				.append( TABLE_COLUMNS[2] )
				.append( TABLE_COLUMNS[3] )
				.append( TABLE_COLUMNS[4] )
				.append( TABLE_COLUMNS[5] )
				.append( TABLE_COLUMNS[6] )
				.append( TABLE_COLUMNS[7] )
				.append( TABLE_COLUMNS[8] )
				.append( TABLE_COLUMNS[9] )
				.append( TABLE_COLUMNS[10] )
				.append( TABLE_COLUMNS[11] )
				.append( TABLE_CONSTRAINTS )
				.append( ")" )
				.toString();
		builder.setLength( 0 );
	}

	public static class TableColumn {
		String columnName;
		String columnType;

		public TableColumn( String name, String type ) {
			this.columnName = name;
			this.columnType = type;
		}

		public String getColumnName() {
			return this.columnName;
		}

		public String toString() {
			return columnName + " " + columnType;
		}
	}
}
